const http = require('http')

http
  .createServer(function(request, response) {
    if (request.url === '/') {
      response.writeHead(301, {
        location: '/new'
      })
      response.end('')
    }
    if (request.url === '/new') {
      response.writeHead(200, {
        'Content-Type': 'text/html'
      })
      response.end(`<h1>redirect</h1>`)
    }
  })
  .listen(8888)

console.log('server in 8888')
